Both protocols transmit packets with a link-layer header fetched from the
beginning of the user's _w_r_i_t_e(2) or _s_e_n_d(2) buffer. They ignore any
destination address supplied to _s_e_n_d_t_o(2) or _c_o_n_n_e_c_t(2). However,
connecting restricts input to packets originating from the foreign
(connected) address.
On input, a protocol-specific header, the link-layer header, and packet
data are copied to the user's _r_e_a_d(2) or _r_e_c_v(2) buffer. All raw domain
protocols guarantee that the offset of packet data from the beginning of
the user's buffer is congruent with RRRRAAAAWWWW____AAAALLLLIIIIGGGGNNNNGGGGRRRRAAAAIIIINNNN. RRRRAAAAWWWW____HHHHDDDDRRRRPPPPAAAADDDD((((_h_d_r_s_i_z_e))))
yields the byte-padding needed to align packet data, given the link-layer
header's size in bytes.
To gather Raw protocol family statistics, call _i_o_c_t_l(2) with a Snoop or
Drain socket, the SSSSIIIIOOOOCCCCRRRRAAAAWWWWSSSSTTTTAAAATTTTSSSS command, and the address of the following
structure, defined in <_n_e_t/_r_a_w._h>:
struct rawstats {
struct snoopstats {
u_long ss_seq;
u_long ss_ifdrops;
u_long ss_sbdrops;
} rs_snoop;
struct drainstats {
u_long ds_ifdrops;
u_long ds_sbdrops;
} rs_drain;
};
The ssssssss____sssseeeeqqqq structure member tells the current Snoop sequence number,
which counts all packets received by the hardware, whether or not they
can be decapsulated. The iiiiffffddddrrrrooooppppssss members tell how many packets were
dropped by the network interface due to resource shortages or hardware
errors. The ssssbbbbddddrrrrooooppppssss members tell how many packets were decapsulated by
the network interface but dropped due to socket buffer limits. See
_g_e_t_s_o_c_k_o_p_t(2) for information on socket buffer sizes and how to change